package edu.sctu.practice.class01.zhoudie.assgin02;

/**
 * Created by Administrator on 2015-10-21.
 */
public class Rational {

    double a;
    double b;
    double addition;
    double subtraction;
    double multiplication;
    double division;

    public Rational(double a,double b){

        this.a=a;
        this.b=b;

        getAddition();
        getSubtraction();
        getMultiplication();
        getDivision();

    }

    public void getAddition(){
        addition=a+b;
    }

    public void getSubtraction(){
        subtraction=a-b;
    }

    public void getMultiplication(){
        multiplication=a*b;
    }

    public void getDivision(){
        division=a/b;
    }
    public static void print(Rational r){
        System.out.println("加减乘除依次得："+r.addition+" "+r.subtraction+" "+r.multiplication+" "+r.division);
    }
}
